import java.util.Scanner;
import java.awt.List;
import java.util.ArrayList;
public class Hello {
    public static void main(String[] args) {
        int b[] = { 1, 2, 5, 9 };// 7
        int a[] = new int[5];
        // a.length=10;
        int input, i;
        Scanner reader = new Scanner(System.in);
        for (int j = 0; j < b.length; j++)
            a[j] = b[j];
        input = reader.nextInt();
        for (i = a.length - 2; i >= 0; i--) {
            if (a[i] > input)
                a[i + 1] = a[i];
            else
                break;
        }
        a[i + 1] = input;
        for (int j :a)
            System.out.print("|" + j);
        int ipt = reader.nextInt();
        int c[] = new int[5];
        int c_index = 0;
        for(int j = 0; j < a.length ; j++)
        { if(a[j] == ipt)
            { continue;
            }
            c[c_index] = a[j];
            c_index = c_index + 1;
        }
        for (int j :c)
            System.out.print(" " + j);
    }
}